using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;


namespace etbTOEIC
{
	/// <summary>
	/// Summary description for FormProperties.
	/// </summary>
	public class FormProperties : System.Windows.Forms.Form
	{
		private Lybra.Forms.Controls.GradientPanelXP gradientPanelXP1;
		private TreeView trvExam;
		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.TabPage tabPage1;
		private System.Windows.Forms.TabPage tabPage2;
		private Lybra.Forms.Controls.GradientPanelXP gradientPanelXP2;
		private etbTOEIC.UCTestInfo ucTestInfo1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox txtSchool;
		private System.Windows.Forms.TextBox txtClass;
		private System.Windows.Forms.TextBox txtDuration;
		private System.Windows.Forms.TextBox txtNotes;
		private System.Windows.Forms.Button btnSave;
		private System.Windows.Forms.Button btnClose;
		

		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public FormProperties()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}
		public FormProperties(TreeView trv)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			trvExam = trv;
			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}


		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormProperties));
			this.gradientPanelXP1 = new Lybra.Forms.Controls.GradientPanelXP();
			this.tabControl1 = new System.Windows.Forms.TabControl();
			this.tabPage1 = new System.Windows.Forms.TabPage();
			this.tabPage2 = new System.Windows.Forms.TabPage();
			this.gradientPanelXP2 = new Lybra.Forms.Controls.GradientPanelXP();
			this.ucTestInfo1 = new etbTOEIC.UCTestInfo();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.txtSchool = new System.Windows.Forms.TextBox();
			this.txtClass = new System.Windows.Forms.TextBox();
			this.txtDuration = new System.Windows.Forms.TextBox();
			this.txtNotes = new System.Windows.Forms.TextBox();
			this.btnSave = new System.Windows.Forms.Button();
			this.btnClose = new System.Windows.Forms.Button();
			this.gradientPanelXP1.SuspendLayout();
			this.tabControl1.SuspendLayout();
			this.tabPage1.SuspendLayout();
			this.tabPage2.SuspendLayout();
			this.gradientPanelXP2.SuspendLayout();
			this.SuspendLayout();
			// 
			// gradientPanelXP1
			// 
			this.gradientPanelXP1.BackColor1 = System.Drawing.Color.White;
			this.gradientPanelXP1.BackColor2 = System.Drawing.Color.Gray;
			this.gradientPanelXP1.Controls.Add(this.tabControl1);
			this.gradientPanelXP1.Controls.Add(this.btnClose);
			this.gradientPanelXP1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.gradientPanelXP1.Gradient = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
			this.gradientPanelXP1.Location = new System.Drawing.Point(0, 0);
			this.gradientPanelXP1.Name = "gradientPanelXP1";
			this.gradientPanelXP1.Size = new System.Drawing.Size(328, 414);
			this.gradientPanelXP1.TabIndex = 0;
			this.gradientPanelXP1.Click += new System.EventHandler(this.gradientPanelXP1_Click);
			// 
			// tabControl1
			// 
			this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.tabControl1.Controls.Add(this.tabPage1);
			this.tabControl1.Controls.Add(this.tabPage2);
			this.tabControl1.Location = new System.Drawing.Point(0, 0);
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new System.Drawing.Size(328, 376);
			this.tabControl1.TabIndex = 2;
			// 
			// tabPage1
			// 
			this.tabPage1.Controls.Add(this.ucTestInfo1);
			this.tabPage1.Location = new System.Drawing.Point(4, 25);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Size = new System.Drawing.Size(320, 347);
			this.tabPage1.TabIndex = 0;
			this.tabPage1.Text = "Statistic";
			// 
			// tabPage2
			// 
			this.tabPage2.Controls.Add(this.gradientPanelXP2);
			this.tabPage2.Location = new System.Drawing.Point(4, 25);
			this.tabPage2.Name = "tabPage2";
			this.tabPage2.Size = new System.Drawing.Size(320, 347);
			this.tabPage2.TabIndex = 1;
			this.tabPage2.Text = "Advance";
			// 
			// gradientPanelXP2
			// 
			this.gradientPanelXP2.BackColor1 = System.Drawing.Color.Gainsboro;
			this.gradientPanelXP2.BackColor2 = System.Drawing.Color.Gray;
			this.gradientPanelXP2.Controls.Add(this.btnSave);
			this.gradientPanelXP2.Controls.Add(this.txtSchool);
			this.gradientPanelXP2.Controls.Add(this.label1);
			this.gradientPanelXP2.Controls.Add(this.label2);
			this.gradientPanelXP2.Controls.Add(this.label3);
			this.gradientPanelXP2.Controls.Add(this.label4);
			this.gradientPanelXP2.Controls.Add(this.txtClass);
			this.gradientPanelXP2.Controls.Add(this.txtDuration);
			this.gradientPanelXP2.Controls.Add(this.txtNotes);
			this.gradientPanelXP2.Dock = System.Windows.Forms.DockStyle.Fill;
			this.gradientPanelXP2.Gradient = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
			this.gradientPanelXP2.Location = new System.Drawing.Point(0, 0);
			this.gradientPanelXP2.Name = "gradientPanelXP2";
			this.gradientPanelXP2.Size = new System.Drawing.Size(320, 347);
			this.gradientPanelXP2.TabIndex = 0;
			// 
			// ucTestInfo1
			// 
			this.ucTestInfo1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.ucTestInfo1.Location = new System.Drawing.Point(0, 0);
			this.ucTestInfo1.Name = "ucTestInfo1";
			this.ucTestInfo1.Size = new System.Drawing.Size(320, 360);
			this.ucTestInfo1.TabIndex = 0;
			// 
			// label1
			// 
			this.label1.BackColor = System.Drawing.Color.Transparent;
			this.label1.Location = new System.Drawing.Point(16, 32);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(80, 23);
			this.label1.TabIndex = 0;
			this.label1.Text = "School";
			// 
			// label2
			// 
			this.label2.BackColor = System.Drawing.Color.Transparent;
			this.label2.Location = new System.Drawing.Point(16, 72);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(80, 23);
			this.label2.TabIndex = 0;
			this.label2.Text = "Class";
			// 
			// label3
			// 
			this.label3.BackColor = System.Drawing.Color.Transparent;
			this.label3.Location = new System.Drawing.Point(16, 112);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(80, 23);
			this.label3.TabIndex = 0;
			this.label3.Text = "Duration";
			// 
			// label4
			// 
			this.label4.BackColor = System.Drawing.Color.Transparent;
			this.label4.Location = new System.Drawing.Point(16, 160);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(80, 23);
			this.label4.TabIndex = 0;
			this.label4.Text = "Notes";
			// 
			// txtSchool
			// 
			this.txtSchool.Location = new System.Drawing.Point(104, 32);
			this.txtSchool.Name = "txtSchool";
			this.txtSchool.Size = new System.Drawing.Size(208, 23);
			this.txtSchool.TabIndex = 1;
			this.txtSchool.Text = "";
			// 
			// txtClass
			// 
			this.txtClass.Location = new System.Drawing.Point(104, 72);
			this.txtClass.Name = "txtClass";
			this.txtClass.Size = new System.Drawing.Size(208, 23);
			this.txtClass.TabIndex = 1;
			this.txtClass.Text = "";
			// 
			// txtDuration
			// 
			this.txtDuration.Location = new System.Drawing.Point(104, 112);
			this.txtDuration.Name = "txtDuration";
			this.txtDuration.Size = new System.Drawing.Size(208, 23);
			this.txtDuration.TabIndex = 1;
			this.txtDuration.Text = "";
			// 
			// txtNotes
			// 
			this.txtNotes.Location = new System.Drawing.Point(32, 192);
			this.txtNotes.Multiline = true;
			this.txtNotes.Name = "txtNotes";
			this.txtNotes.Size = new System.Drawing.Size(272, 88);
			this.txtNotes.TabIndex = 1;
			this.txtNotes.Text = "";
			// 
			// btnSave
			// 
			this.btnSave.BackColor = System.Drawing.Color.Transparent;
			this.btnSave.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnSave.BackgroundImage")));
			this.btnSave.Location = new System.Drawing.Point(192, 304);
			this.btnSave.Name = "btnSave";
			this.btnSave.Size = new System.Drawing.Size(96, 32);
			this.btnSave.TabIndex = 2;
			this.btnSave.Text = "&Save";
			this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
			// 
			// btnClose
			// 
			this.btnClose.BackColor = System.Drawing.Color.Transparent;
			this.btnClose.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnClose.BackgroundImage")));
			this.btnClose.Location = new System.Drawing.Point(224, 376);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new System.Drawing.Size(96, 32);
			this.btnClose.TabIndex = 2;
			this.btnClose.Text = "&Close";
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// FormProperties
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 16);
			this.ClientSize = new System.Drawing.Size(328, 414);
			this.ControlBox = false;
			this.Controls.Add(this.gradientPanelXP1);
			this.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "FormProperties";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Exam Properties";
			this.Load += new System.EventHandler(this.FormProperties_Load);
			this.gradientPanelXP1.ResumeLayout(false);
			this.tabControl1.ResumeLayout(false);
			this.tabPage1.ResumeLayout(false);
			this.tabPage2.ResumeLayout(false);
			this.gradientPanelXP2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void label1_Click(object sender, System.EventArgs e)
		{
		
		}

		private void FormProperties_Load(object sender, System.EventArgs e)
		{
			txtSchool.Text = DB2MainForm.stSchool;
			txtClass.Text = DB2MainForm.stClass;
			txtNotes.Text = DB2MainForm.stNotes;
			txtDuration.Text = DB2MainForm.Duration.ToString();
			DB2MainForm.LoadTestInfo(ucTestInfo1, trvExam);
		}

		private void btnClose_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void gradientPanelXP1_Click(object sender, System.EventArgs e)
		{
		
		}

		private void btnSave_Click(object sender, System.EventArgs e)
		{
			DB2MainForm.stSchool = txtSchool.Text;
			DB2MainForm.stClass = txtClass.Text;
			DB2MainForm.stNotes = txtNotes.Text;
			try
			{
				DB2MainForm.Duration = Convert.ToInt64(txtDuration.Text.Trim());
			}catch(Exception)
			{
				DB2MainForm.Duration = 0;
			}
		}
	}
}
